package com.hospital.enumeration;

import com.hospital.constant.MessageConstant;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum HospitalizationStatus {
    IN_HOSPITAL("住院中"),
    DISCHARGED("已出院");

    private final String value;

    public static HospitalizationStatus fromValue(String value) {
        for (HospitalizationStatus hospitalizationStatus : HospitalizationStatus.values()) {
            if (hospitalizationStatus.getValue().equals(value)) {
                return hospitalizationStatus;
            }
        }
        throw new IllegalArgumentException(MessageConstant.PARAM_ERROR);
    }
}
